<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOrderAssetsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('order_assets', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->bigInteger('order_id')->index()->comment('订单ID');
            $table->bigInteger('user_id')->index()->comment('用户ID');
            $table->bigInteger('product_id')->index()->comment('商品ID');
            $table->string('contract_address', 64)->index()->comment('商品合约地址, 作品唯一编号');
            $table->string('token_id', 64)->index()->comment('资产凭证ID');
            $table->string('trans_hash', 128)->nullable()->comment('交易凭证');
            $table->string('asset_status', 16)->comment('资产交易状态');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('order_assets');
    }
}
